package sosopkpk;

import java.util.Scanner;

public class J10Account {
	// 입력값 : 계좌번호, 통장잔액, 연간 이자율, 통장개설 날짜
	// 변수 : 계좌번호, 통장잔액, 연간 이자율, 통장개설 날짜, 월간 이자율, 인출, 예금
	public static void main(String[] args) {
		int aid[] = new int[2];
		int balance[] = new int[4];
		int withDraw[] = new int[2];
		int deposit[] = new int[2];
		double interestRate[] = new double[2];
		String dateCreated[] = new String[2];
		double monthlyInterestRagte;
		String result = "";

		inputAccount(aid, balance, interestRate, dateCreated, withDraw, deposit);
		monthlyInterestRagte = getmonthlyInterestRagte(interestRate);
		balance[2] = withDraw(balance, withDraw);
		balance[3] = deposit(balance, deposit);

		result = "\n계좌번호 : " + aid[1] + "\n통장 잔액 : " + balance[1] + "\n연이율 : "
				+ interestRate[1] + "\n통장 개설날짜 : " + dateCreated[1]
				+ "\n인출할 금액 : " + withDraw[1] + "\n예금할 금액 : " + deposit[1]
				+ "\n월이율 : " + monthlyInterestRagte + "\n인출 후 통장 잔액 : "
				+ balance[2] + "\n예금 후 통장 잔액 : " + balance[3];
		
		System.out.println(result);
	} // main

	private static void inputAccount(int[] aid, int[] balance,
			double[] interestRate, String[] dateCreated, int[] withDraw,
			int[] deposit) {
		Scanner sc = new Scanner(System.in);
		System.out.println("계좌번호를 입력해 주세요.");
		aid[1] = sc.nextInt();
		System.out.println("통장잔액을 입력해 주세요.");
		balance[1] = sc.nextInt();
		System.out.println("연간 이자율을 입력해 주세요.");
		interestRate[1] = sc.nextDouble();
		System.out.println("통장 개설한 날짜를 입력해 주세요.");
		dateCreated[1] = sc.next();
		System.out.println("인출할 금액을 입력해 주세요.");
		withDraw[1] = sc.nextInt();
		System.out.println("예금할 금액을 입력해 주세요.");
		deposit[1] = sc.nextInt();
		sc.close();
	} // inputAccount

	private static double getmonthlyInterestRagte(double[] interestRate) {
		return interestRate[1] / 12;
	}

	private static int withDraw(int[] balance, int[] withDraw) {
		return balance[1] - withDraw[1];
	}

	private static int deposit(int[] balance, int[] deposit) {
		return balance[2] + deposit[1];
	}

} // class
